package com.zelin.yang.kotlin_demo.Base

import android.content.Context
import android.os.Bundle
import android.support.annotation.LayoutRes
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

abstract class BaseFragment : Fragment() {
    lateinit var mContext: Context
    @LayoutRes
    abstract fun getLayoutId():Int
    abstract fun Initview()
    abstract fun initDate()
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(getLayoutId(),null)
    }

    override fun onAttach(context: Context?) {
        super.onAttach(context)
        mContext = context as BaseActivity
    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        Initview()
        initDate()
    }
}